package cn.stylefeng.guns.modular.app.controller;

import cn.stylefeng.guns.modular.app.dto.*;
import cn.stylefeng.guns.modular.app.dto.e.*;
import cn.stylefeng.guns.modular.app.entity.CoinApply;
import cn.stylefeng.guns.modular.app.entity.Member;
import cn.stylefeng.guns.modular.app.service.*;
import cn.stylefeng.guns.modular.app.vo.ApiPayPwdVo;
import cn.stylefeng.guns.modular.app.vo.ForgetVo;
import cn.stylefeng.guns.modular.app.vo.LoginVo;
import cn.stylefeng.guns.modular.app.vo.RegVo;
import cn.stylefeng.guns.modular.app.vo.e.ApiWalletVo;
import cn.stylefeng.guns.modular.base.util.RedisUtil;
import cn.stylefeng.guns.modular.base.util.Result;
import cn.stylefeng.guns.modular.bulletin.entity.Contact;
import cn.stylefeng.guns.modular.bulletin.entity.Subscribe;
import cn.stylefeng.guns.modular.bulletin.model.ContactAddDto;
import cn.stylefeng.guns.modular.bulletin.model.ContactDto;
import cn.stylefeng.guns.modular.bulletin.service.ContactService;
import cn.stylefeng.guns.modular.bulletin.service.SubscribeRecordsService;
import cn.stylefeng.guns.modular.bulletin.service.SubscribeService;
import cn.stylefeng.guns.modular.coin.entity.Spot;
import cn.stylefeng.guns.modular.coin.entity.SpotPledgeLever;
import cn.stylefeng.guns.modular.coin.entity.SpotStaticLever;
import cn.stylefeng.guns.modular.fin.entity.Currency;
import cn.stylefeng.guns.modular.fin.service.CurrencyService;
import cn.stylefeng.guns.modular.fin.service.FinMiningService;
import cn.stylefeng.guns.modular.trc.service.TrcRechargeService;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * app入口
 */
@RestController
@RequestMapping(value = "/api")
@Api(tags = "app入口")
public class HomeApi{


    @Autowired
    RedisUtil redisUtil;
    @Resource
    private HomeService homeService;
    @Resource
    private CurrencyService currencyService;

    @Resource
    private SubscribeRecordsService subscribeRecordsService;

    @Resource
    private CommonService commonService;

    @Resource
    private AsyncService asyncService;

    @Resource
    private HomeWalletService homeWalletService;

    @Autowired
    private FinMiningService finMiningService;

    @Autowired
    private ContactService contactService;

    /**
     * 注册
     * @param regVo regVogetMsg
     * @return Result
     */
    @ApiOperation("注册")
    @PostMapping("/register")
    public Result register(@Valid RegVo regVo){
        return homeService.register(regVo);
    }

    /**
     * 登录
     * @param loginVo loginVo
     * @return Result
     * @return Result
     */
    @ApiOperation("登陆")
    @PostMapping("/login")
    public Result login(@Valid LoginVo loginVo){
        return homeService.login(loginVo);
    }

    /**
     * 检查验证码是否正确
     * @param account 账号
     * @param code 验证码
     * @return Result
     */
    @ApiOperation("检查验证码是否正确")
    @PostMapping("/checkSmsCode")
    public Result checkSmsCode(String account,String code,@RequestHeader("token") String token){
        return homeService.checkSmsCode(account,code,token);
    }

    /**
     * 忘记密码
     * @return Result
     */
    @ApiOperation("忘记密码")
    @PostMapping("/forgetPwd")
    public Result forgetPwd(@Valid ForgetVo forgetVo){
        return homeService.forgetPwd(forgetVo);
    }


    /**
     * 退出登录
     */
    @ApiOperation("退出登录")
    @PostMapping("/logout")
    public Result logout(@RequestHeader("token") String token){
        return homeService.logout(token);
    }

    /**
     * 获取验证码
     * @param type  类型
     * @return Result
     */
    @ApiOperation("获取验证码")
    @PostMapping("/getMsg")
    public Result msg(@RequestHeader(value = "token", required = false, defaultValue = "-1") String token,
//                      @RequestParam(required = false) String code,
//                      @RequestParam(required = false) String phone,
                      @RequestParam(required = false) String account,
                      @RequestParam(value = "type", required = false, defaultValue = "1") Long type){
        return homeService.getMsg(token, "", "", type, account);
    }

//     /**
//     * 获取验证码
//     * @return Result
//     */
//
//     @ApiOperation("获取验证码")
//    @PostMapping("/sysMsg")
//    public Result sysMsg()
//    {
//        return homeService.sysMsg();
//    }



    /**
     * 刷新token
     */

    @ApiOperation("刷新token")
    @PostMapping("/refreshToken")
    public Result refreshToken(@RequestHeader("token") String token)
    {
        return homeService.refreshToken(token);
    }


    /**
     * 安全中心
     */

    @ApiOperation("设置密码")
    @PostMapping("/pwd")
    public Result pwd(@RequestHeader("token") String token, @Valid ApiPayPwdVo apiPayPwdVo){
        return homeService.pwd(token, apiPayPwdVo);
    }
//
//    /**
//     * 修改法币交易昵称
//     * @param token
//     * @param  nickName 昵称
//     * @return Result
//     */
//
//    @ApiOperation("修改法币交易昵称")
//    @PostMapping("/nickName")
//    public Result nickName(@RequestHeader("token") String token,String nickName){
//        return homeService.nickName(token,nickName);
//    }
//
//
//    /**
//     * 签到
//     */
//    @PostMapping("/checkIn")
//    public Result checkIn(@RequestHeader("token") String token)
//    {
//        return homeService.checkIn(token);
//    }
//
//    /**
//     * 签到信息
//     */
//    @PostMapping("/checkInfo")
//    public Result checkInfo(@RequestHeader("token") String token)
//    {
//        return homeService.checkInfo(token);
//    }


    /**
     * 用户信息
     * @param token token
     * @return Result
     */

    @ApiOperation("用户信息")
    @PostMapping("/info")
    public Result info(@RequestHeader("token") String token){
        return homeService.info(token);
    }

    /**
     * 手机绑定或邮箱绑定
     * @param token token 用户唯一标识
     * @param dto dto
     * @return Result
     */

    @ApiOperation("手机绑定或邮箱绑定")
    @PostMapping("/bindAccount")
    public Result bindAccount(@RequestHeader("token") String token, ApiBindAccountDto dto){
        return homeService.bindAccount(token, dto);
    }

    /**
     * 实名认证
     * @param token token
     * @param dto dto
     * @return Result
     */

    @ApiOperation("实名认证")
    @PostMapping("/verify")
    public Result verify(@RequestHeader("token") String token, @Valid ApiVerifyDto dto){
        return homeService.verify(token, dto);
    }

    /*
     * ========================================================================================================
     *
     *                                         项目业务接口
     *
     *
     * ========================================================================================================
     */
//
//    /**
//     * 收款方式列表
//     *
//     * @param token token
//     * @param page page
//     * @return Result
//     */
//
//    @ApiOperation("收款方式列表")
//    @PostMapping("/cnyPayList")
//    public Result cnyPayList(@RequestHeader("token") String token, Page page){
//        return homeService.cnyPayList(token, page);
//    }
//
//
//    /**
//     * 添加收款方式
//     *
//     * @param token token
//     * @param dto dto
//     * @return Result
//     */
//
//    @ApiOperation("添加收款方式")
//    @PostMapping("/cnyPayAdd")
//    public Result cnyPayAdd(@RequestHeader("token") String token, @Valid ApiPayDto dto){
//        return homeService.cnyPayAdd(token, dto);
//    }
//
//    /**
//    /**
//     * 删除收款方式
//     * @param token token
//     * @param paymentId paymentId
//     * @return Result
//     */
//
//    @ApiOperation("删除收款方式")
//    @PostMapping("/cnyPayDel")
//    public Result cnyPayDel(@RequestHeader("token") String token, Long paymentId)
//    {
//        return homeService.cnyPayDel(token, paymentId);
//    }

    /**
     *  =============
     *      资产
     *  =============
     */
    /**
     * 资产信息
     *
     * @param token token
     * @param vo vo
     * @return Result
     */

    @ApiOperation("资产信息")
    @GetMapping("/wallet")
    public Result wallet(@RequestHeader("token") String token, @Valid ApiWalletVo vo)
    {//
        // return homeService.wallet(token, vo);
        return homeWalletService.wallet(token, vo);
    }


    @RequestMapping("/addFavorite")
    public Result addFavorite(@RequestHeader("token") String token, @Valid String symbol)
    {//
        return homeService.addFavorite(token, symbol);
    }
    @RequestMapping("/delFavorite")
    public Result delFavorite(@RequestHeader("token") String token, @Valid Long fid)
    {//
        return homeService.delFavorite(token, fid);
    }
    @RequestMapping("/favorite")
    public Result favorite(@RequestHeader("token") String token)
    {//
        return homeService.selectFavorite(token);
    }
    @RequestMapping("/findFavorite")
    public Result findFavorite(@RequestHeader("token") String token, @Valid String symbol)
    {//
        return homeService.findFavorite(token,symbol);
    }

    @ApiOperation("申购币种获取支付币种余额")
    @GetMapping("/subscribeTokenList")
    public Result subscribeTokenList(@RequestHeader("token") String token,Long sid){
//        Map<String, Object> map = new HashMap<>();
//        Subscribe news = new Subscribe();
//        news.setStatus("Y");
//        news.setId(sid);
//        news= subscribeService.getOne(new QueryWrapper<>(news));
//        if(news!=null){
//
         Member member = (Member) redisUtil.get(token);
//
//            String currency=news.getSubscribeCurrency();
//            String[] arr=currency.split("/");
//            for (String str:arr) {
//                Map<String,Object>tem=new HashMap<>();
//               // tem.put("val",commonService.getcoinatocoinbusdt(str,news.getCoinName()));
//                tem.put("name",str);
//
//                map.put(str,tem);
//            }
//        }
        return Result.success("USDT余额",currencyService.getUsedPrice(member.getMemberId(),"USDT"));
    }

    @ApiOperation("提交申购")
    @PostMapping("/submitSubscribe")
    public Result submitSubscribe(@RequestHeader("token") String token,Long sid,Integer amount){
        return subscribeRecordsService.submitSubscribe(token,sid,amount);
    }
    @GetMapping("/subscribeRecords")
    @ApiOperation("申购记录")
    public Result subscribeRecords(@RequestHeader("token") String token,Integer pageIndex,Integer pageSize) {
        return subscribeRecordsService.subscribeRecords(token,pageIndex,pageSize);
    }
    /**
     * 账户详情
     * @return Result
     */
    @PostMapping("/walletDetail")
    public Result walletDetail(@RequestHeader("token") String token, Long id, String type){
        return homeService.walletDetail(token, id, type);
    }


    /**
     * 充币地址 用户地址
     */
       @GetMapping("/userRechargeAddress")
       @ApiOperation("充币地址 （TRC或ERC）")
    public Result<String> platformAddress(@RequestHeader("token") String token,String symbol){
        return homeService.platformAddress(token,symbol);
    }

//    /**
//     * 提交充值
//     * @param token
//     * @param dto
//     * @return
//     */
//    @RequestMapping("/recharge")
//    public Result recharge(@RequestHeader("token") String token, ApiRechargeDto dto){
//        return homeService.recharge(token,dto);
//    }



    /**
     * 提币页面信息
     */
    @GetMapping("/withdrawPage")
    @ApiOperation("提币页面信息")
    public Result withdrawPage(@RequestHeader("token") String token){
        return homeService.withdrawPage(token, "USDT");
    }


    /**
     * 提币
     * @param token token
     * @param vo vo
     * @return Result
     * @throws Exception Exception
     */

    @ApiOperation("提币")
    @PostMapping("/withdrawCoin")
    public Result withdrawCoin(@RequestHeader("token") String token, @Valid ApiWithdrawCoinVo vo) throws Exception{
        return homeService.withdrawCoin(token, vo);
    }

//    /**
//     * 提币
//     * @param token token
//     * @param vo vo
//     * @return Result
//     * @throws Exception Exception
//     */
//    @RequestMapping("/withdrawCoinApp")
//    public Result withdrawCoinApp(@RequestHeader("token") String token, @Valid ApiWithdrawCoinVo vo) throws Exception{
//        return homeService.withdrawCoinApp(token, vo);
//    }

    /**
     * 充币/提币 记录
     */
    @PostMapping("/coinRecord")
    public Result coinRecord(@RequestHeader("token") String token, String type, Page page
            ,@RequestParam(required = false,value = "symbol") String symbol){
        return homeService.coinRecord(token, type, page,symbol);
    }

    /**
     * 添加/删除用户钱包地址
     *
     * @param token token
     * @param dto dto
     * @return Result
     */
    @PostMapping("/coin")
    public Result coin(@RequestHeader("token") String token, ApiCoinDto dto)
    {
        return homeService.coin(token, dto);
    }


    /**
     * 钱包地址列表
     *
     * @param token token
     * @param page page
     * @return Result
     */
    @PostMapping("/coinList")
    public Result coinList(@RequestHeader("token") String token, String coin, Page page)
    {
        return homeService.coinList(token, coin, page);
    }


    /**
     * 获取可质押币种
     *
     * @return Result
     */
    @GetMapping("/getPledgeSpot")
    @ApiOperation("获取可质押币种 新增质押使用）")
    public Result<List<Map<String,Object>> >  getPledgeSpot(@RequestHeader("token") String token)
    {
        return homeService.getPledgeSpot(token);
    }


    /**
     * 根据质押币种获取可获取数量
     *
     * @return Result
     */
    @GetMapping("/getPledgeSpotNum")
    @ApiOperation("根据质押币种获取可获取数量 （新增选择币种后） 如BTB")
    public Result<List<SpotPledgeLever>> getPledgeSpotNum(@RequestHeader("token") String token, String type)
    {
        return homeService.getPledgeSpotNum(type);
    }


    /**
     * 质押
     *
     * @param token token
     * @return Result
     */
    @PostMapping("/pledge")
    @ApiOperation("质押")
    public Result pledge(@RequestHeader("token") String token,@Valid ApiPledgeDto apiPledgeDto)
    {
        return homeService.pledge(token, apiPledgeDto);
    }


    /**
     * 获取挖矿静态收益配置
     *
     * @param token token
     * @return Result
     */
    @GetMapping("/getSpotStaticLever")
    @ApiOperation("获取挖矿静态收益配置")
    public Result<List<SpotStaticLever>> getSpotStaticLever(@RequestHeader("token") String token, String type)
    {
        return homeService.getSpotStaticLever(token,type);
    }



    /**
     * 可挖矿账户列表
     *
     * @param token token
     * @return Result
     */
    @GetMapping("/getMiningCurrency")
    @ApiOperation("可挖矿账户列表")
    public Result<List<ApiMiningCurrencyCoinDto>> getMiningCurrency(@RequestHeader("token") String token)
    {
        return homeService.getMiningCurrency(token);
    }




    /**
     * 挖矿
     *
     * @param token token
     * @return Result
     */
    @PostMapping("/mining")
    @ApiOperation("挖矿")
    public Result<Boolean> mining(@RequestHeader("token") String token,@Valid  ApiMiningDto miningDto)
    {
        return homeService.mining(token, miningDto);
    }






    /**
     * 内部转账页面信息
     *
     * @param token token
     * @return Result
     */
    @GetMapping("/transferPage")
    @ApiOperation("转账数据 获取可转的账户及余额")
    public Result<List<Currency>> transferPage(@RequestHeader("token") String token)
    {
        return homeService.transferPage(token);
    }

    /**
     * 内部转账
     *
     * @param token token
     * @return Result
     */
    @PostMapping("/transfer")
    @ApiOperation("内部转账（互转）")
    public Result transfer(@RequestHeader("token") String token,@Valid ApiTransferDto apiTransfer)
    {
        return homeService.transfer(token, apiTransfer);
    }

    /**
     * 内部转账记录
     *
     * @param token token
     * @param page page
     * @return Result
     */
    @PostMapping("/transferRecordFlow")
    public Result transferRecordFlow(@RequestHeader("token") String token, Page page)
    {
        return homeService.transferRecordFlow(token, page);
    }

//    /**
//     * 资产划转页面信息
//     *
//     * @param token token
//     * @return Result
//     */
//    @RequestMapping("/convertPage")
//    public Result convertPage(@RequestHeader("token") String token, @Valid ApiConvertPageDto apiConvertPageDto){
//        return homeService.convertPage(token, apiConvertPageDto);
//    }
//
//    /**
//     * 资产划转
//     * @param token token
//     * @param apiConvertDto apiConvertDto
//     * @return Result
//     */
//    @RequestMapping("/convert")
//    public Result convert(@RequestHeader("token") String token, @Valid ApiConvertDto apiConvertDto){
//        return homeService.convert(token, apiConvertDto);
//    }


    /**
     * 流水记录
     * @param token token
     * @return Result
     */
    @GetMapping("/cashflow")
    @ApiOperation("流水记录")
    public Result cashflow(@RequestHeader("token") String token, Integer current,Integer size,
                           @RequestParam(required = false,value = "symbols") String symbols,
                           @RequestParam(required = false,value = "flowType") String flowType
                    ){
        return homeService.cashflow(token, current,size, symbols,flowType);
    }


    /**
     *              币币   start
     */

   /* *//**
     * 币币交易 (原接口）
     *//*
    @PostMapping("/currency")
    public Result currency(@RequestHeader("token") String token, @Valid ApiCurrencyDto dto)
    {
        return homeService.currrency(token, dto);
   }*/

    /**
     * 币币交易
     */
    @PostMapping("/currency")
    @ApiOperation("币币交易")
    public Result currency(@RequestHeader("token") String token, @Valid ApiCurrencyDto dto) throws Exception
    {
        return  asyncService.currencyV2(token, dto).get();
    }


    /**
     * 币币交易页面信息
     *
     * @param token token
     * @param type type
     * @return Result
     */
    @PostMapping("/currencyPage")
    public Result currencyPage(@RequestHeader("token") String token, @RequestParam(defaultValue = "BTB/USDT") String type,@RequestParam(defaultValue = "BUY") String matchType)
    {
        return homeService.currencyPage(token, type,matchType);
    }

    /**
     * 撤销币币交易委托单
     */
    @PostMapping("/cancelCurrency")
    public Result cancelCurrency(@RequestHeader("token") String token, Long matchId){
        return homeService.cancelCurrency(token, matchId);
    }

    /**
     * 币币委托 记录
     *
     * @param type 1-当前委托 2-买入  3-卖出 4-撤销
     */
    @RequestMapping("/currencyRecord")
    public Result currencyRecord(@RequestHeader("token") String token, @RequestParam(defaultValue = "1") int type, Page page,@RequestParam(required = false,value = "symbols")String symbols)
    {
        return homeService.currencyRecord(token, type, page,symbols);
    }


    /**
     * 止盈止损设置
     */
    @RequestMapping("/contractPl")
    public Result contractPl(@RequestHeader("token")String token,@Valid ApiPlDto dto){
        return homeService.contractPl(token,dto);
    }




    /*理财start */
    @GetMapping("finPeriodicList")
    @ApiOperation("理财记录")
    public Result finPeriodicList() {
        return homeService.finPeriodicList();
    }
    @RequestMapping("finPeriodicMyOrderList")
    public Result finPeriodicMyOrderList(@RequestHeader("token") String token) {
        return homeService.finPeriodicMyOrderList(token);
    }

    @ApiOperation("提交理财")
    @PostMapping("finPeriodicOrderAdd")
    public Result finPeriodicOrderAdd(@RequestHeader("token") String token,Long periodicId,BigDecimal amount) {
        return homeService.finPeriodicOrderAdd(token,periodicId,amount);
    }

    /**理财end*/





    /**
     * 留言列表
     *
     * @param token token
     * @return Result
     */
    @GetMapping("/getContactList")
    @ApiOperation("留言列表")
    public Result<List<Contact>> getContactList(@RequestHeader("token") String token)
    {
        Member member = (Member) redisUtil.get(token);
        return Result.success("留言列表",contactService.list(member.getAccount()));
    }


    /**
     * 留言
     *
     * @param token token
     * @return Result
     */
    @PostMapping("/addContact")
    @ApiOperation("留言")
    public Result<Boolean> addContact(@RequestHeader("token") String token, @Valid ContactAddDto contactDto)
    {
        Member member = (Member) redisUtil.get(token);
        return Result.success("留言成功",contactService.addContact(member.getAccount(),contactDto.getContactName()));
    }







//    //认购
//    @RequestMapping("teManagementOrderAdd") //getMyLogList0Api
//    public Result teManagementOrderAdd(@RequestHeader("token") String token,Long teManagementId,BigDecimal amount) {
//        return homeService.teManagementLogAdd(token,teManagementId,amount);
//    }

    //参与 进行
    @RequestMapping("teManagementOrderList0")
    public Result teManagementOrderList0(@RequestHeader("token") String token,Page page) {
        return homeService.teManagementLogList(token,page);
    }
    //参与 结束
    @RequestMapping("teManagementOrderList1")
    public Result teManagementOrderList1(@RequestHeader("token") String token,Page page) {
        return homeService.teManagementLogList1(token, page);
    }
    //释放记录
    @RequestMapping("teManagementReleaseList")
    public Result teManagementReleaseList(@RequestHeader("token") String token) {
        return homeService.teManagementReleaseList(token);
    }

    /*团队邀请 start*/
    @RequestMapping("myearnings")
    public Result myearnings(@RequestHeader("token") String token
    ) {

        return homeService.myearnings(token);
    }
    @GetMapping("earningsInfo")
    @ApiOperation("获取我的大小区BTB总量")
    public Result earningsInfo(@RequestHeader("token") String token
    ) {

        return homeService.earningsInfo(token);
    }


    @GetMapping("getIsMining")
    @ApiOperation("获取是否挖矿")
    public Result getIsMining(@RequestHeader("token") String token
    ) {
        Member member = (Member) redisUtil.get(token);
        return Result.success("是否挖矿信息",finMiningService.isMining(member.getMemberId(), LocalDate.now()));
    }




    @RequestMapping("earningsPage")
    public Result earningsPage(@RequestHeader("token") String token,Page page
    ) {

        return homeService.earningsPage(page,token);
    }
    @GetMapping("teamDetail")
    @ApiOperation("团队成员")
    public Result teamDetail(@RequestHeader("token") String token,Integer current,Integer size
    ) {

        return homeService.teamDetail(token,current,size);
    }
    @RequestMapping("freeTransferForWallet")
    public Result freeTransferForWallet(@RequestHeader("token") String token,BigDecimal price
    ) {

        return homeService.freeTransferForWallet(token,price);
    }

    @RequestMapping("freeTransferForWalletLog")
    public Result freeTransferForWalletLog(@RequestHeader("token") String token,Page page
    ) {

        return homeService.freeTransferForWalletLog(token,page);
    }
    //团队邀请 end

    @RequestMapping("addCoinApply")
    public Result addCoinApply(@RequestHeader("token") String token, CoinApply coinApply,String code) {

        return homeService.addCoinApply(token,coinApply,code);
    }


    @RequestMapping("addMiningOrder")
    public Result addMiningOrder(@RequestHeader("token") String token, Long id) {

        return homeService.addMiningOrder(token,id);
    }

    @RequestMapping("miningOrder")
    public Result miningOrder(@RequestHeader("token") String token,Page page) {
        return homeService.miningOrder(token,page);
    }

    @RequestMapping("miningOrderDetail")
    public Result miningOrderDetail(@RequestHeader("token") String token,Page page) {
        return homeService.miningOrderDetail(token,page);
    }
    @RequestMapping("startUpMiningOrder")
    public Result startUpMiningOrder(@RequestHeader("token") String token,Long id) {
        return homeService.startUpMiningOrder(token,id);
    }
    @RequestMapping("pickMiningOrder")
    public Result pickMiningOrder(@RequestHeader("token") String token,Long id,String type) {
        return homeService.pickMiningOrder(token,id,type);
    }

    @RequestMapping("chenkDayConfig")
    public Result chenkDayConfig(@RequestHeader("token") String token) {
        return homeService.chenkDayConfig(token);
    }

    @RequestMapping("getWithdrawMinNum")
    public Result getWithdrawMinNum() {
        return homeService.getWithdrawMinNum();
    }

    @RequestMapping("getChatList")
    public Result getChatList(@RequestHeader("token") String token) {
        return homeService.getChatList(token);
    }

    @RequestMapping("checkChatPwd")
    public Result checkChatPwd(@RequestHeader("token") String token, String pwd) {
        return homeService.checkChatPwd(token,pwd);
    }



}
